﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class CreateNews : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx");
    }
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        AddReport();
    }

    void AddReport()
    {
        New_Report report = new New_Report()
        {
            ChanelName = ddlNewsType.SelectedValue,
            TitleNews = txtTitleNew.Text,
            Author = txtAuthor.Text,
            NewsContent = txtNewContent.Text,
            TimePost = DateTime.Now,
            CountRead = 0,
            CountComments=0
        };
        NewReportDataContext data = new NewReportDataContext();
        data.New_Reports.InsertOnSubmit(report);
        data.SubmitChanges();
    }



}
